<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="shiyue" uri="http://www.shiyue.com" %>
<%
String path = request.getContextPath();
%>

<!-- 教师任课安排  2011-11-03 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
		<title>教师任课安排</title>
		<link href="<%=path %>/css/index_css.css" rel="stylesheet" type="text/css" />
		<link rel="stylesheet" type="text/css" href="<%=path %>/css/paging.css">
        <script src="<%=path%>/js/resizeIframe.js" type="text/javascript"></script>
		<script src="<%=path%>/dwr/engine.js"></script>
	    <script src="<%=path%>/dwr/util.js"></script>
	    <script src="<%=path%>/dwr/interface/shiyueDwr.js"></script>
	    <script language="javascript" src="<%=path %>/js/paging.js"></script>
		<script type="text/javascript">	
		function showModel2(userId,courseId,obj){
			 //判断是不是当前年度
	        if(document.getElementById('year').value=='${applicationScope.currentYear}')
			{	
				var returnStr=window.showModalDialog("<%=path%>/findRKClassByUserIdAndCourseIdGradeAndClassAction.action?year=${applicationScope.currentYear}&userId="+userId+"&courseId="+courseId+"&t="+new Date(),"","dialogHeight:400px;dialogWidth:600px;help=0;scroll=1;");
				if(returnStr==undefined){
					return;
				}	
				if(returnStr!=null){
				    obj.innerHTML=returnStr;
				}
			}
	      	else
	      	{
	      		alert("不是当前年度，不能进行此操作！");
	      	}
		}
      
        function tdClick(url)
        {
          window.location.href=url;
        }
        
        function change(year)
        {
          window.location.href='<%=path%>/getRKClassByUserIdAndcourseIdGradeAndClassAction.action?year='+year;
        }
        
	    function getAllYearCallBack(yearMap) {
		     DWRUtil.addOptions("year", yearMap);
		     if('${year}'!="")
		   	{
		   	  document.getElementById('year').value="${year}";
		   	}
		   	else if('${currentYear}'!="")
		   	{
		   	  document.getElementById('year').value="${currentYear}";
		   	}
		   	var objURL= "<%=path%>/getRKClassByUserIdAndcourseIdGradeAndClassAction.action?year="+document.getElementById('year').value+"&currentPage=${currentPage}";		
			paging(objURL,pageInfo);
	    }
	    
	    var pageInfo = ${shiyue:toJSONWithExclude(pageInfo, "class,pageData")};
		window.onload   =   function(){
			resizeIframe();
		    parent.location.hash="top";
			shiyueDwr.getAllYear(getAllYearCallBack);
		}
		
		//浮动表头 
	    function floatTr(obj)  {
			var ftr = document.getElementById('ftr');
			ftr.style.top= obj.scrollTop; 
		}
	     
    </script>
  </head>
  
  <body >
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="2" align="left" class="f_5">岗位安排</td>
  </tr>
  <tr>
    <td height="1" colspan="2" bgcolor="#9DD12E"></td>
  </tr>
  <tr>
    <td colspan="2" align="left" valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2" align="left"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="left" valign="bottom" background="<%=path %>/images/sywesp_24.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          
          <tr>
            <td width="80" align="left"><table width="80" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="1" align="left" valign="bottom" bgcolor="#CBCBCB"></td>
                <td align="center" background="<%=path %>/images/sywesp_25.gif" class="f_9">任课安排</td>
                <td width="1" height="31" align="right" valign="bottom" bgcolor="#CBCBCB"></td>
              </tr>
            </table></td>
            <td width="90" align="left"><table width="90" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="center" background="<%=path %>/images/sywesp_18.gif" class="f_6" onclick="tdClick('classLeaderUserAction.action?year=${currentYear }');" style="cursor:pointer;">班主任安排</td>
                <td width="1" height="31" align="right" valign="bottom" bgcolor="#CBCBCB"></td>
              </tr>
            </table></td>
            <td width="100" align="left"><table width="100" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="center" background="<%=path %>/images/sywesp_18.gif" class="f_6" onclick="tdClick('gradeSubjectTeamLeaderorganizationAction.action?role.roleId=bkzz&years=${currentYear }');" style="cursor:pointer;">备课组长安排</td>

                <td width="1" height="31" align="right" valign="bottom" bgcolor="#CBCBCB"></td>
              </tr>
            </table></td>
            <td width="100" align="left"><table width="100" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="center" background="<%=path %>/images/sywesp_18.gif" class="f_6" onclick="tdClick('subjectTeamLeaderorganizationAction.action?role.roleId=jyzz&year.name=${currentYear }');" style="cursor:pointer;">教研组长安排</td>

                <td width="1" height="31" align="right" valign="bottom" bgcolor="#CBCBCB"></td>
              </tr>
            </table></td>
            <td width="100" align="left"><table width="100" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="center" background="<%=path %>/images/sywesp_18.gif" class="f_6" onclick="tdClick('toGradeTeamLeaderGradeAndClassAction.action?year=${currentYear }&role.roleId=njzz');" style="cursor:pointer;">年级组长安排</td>
                <td width="1" height="31" align="right" valign="bottom" bgcolor="#CBCBCB"></td>
              </tr>
            </table></td>
            <td width="110" align="left"><table width="110" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="center" background="<%=path %>/images/sywesp_18.gif" class="f_6" onclick="tdClick('departmentLeaderorganizationAction.action?role.roleId=bmfzr&year.name=${currentYear }');" style="cursor:pointer;">部门负责人安排</td>
                <td width="1" height="31" align="right" valign="bottom" bgcolor="#CBCBCB"><br></td>
              </tr>
            </table></td>
            <td align="left">&nbsp;</td>
          </tr>
        </table></td>
      </tr>
      
      <tr>
        <td align="left" valign="top" class="tb_8 border_2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="25" align="left" valign="middle"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="left">按年度查询：
                  <label>
                  <select name="select2" id="year" onchange="change(this.value);">
                  </select>
                  </label>
                  <br /></td>
                <td align="right" valign="top"><a href="<%=path %>/getAllCourseByGradeIdGradeAndClassAction.action?year=${applicationScope.currentYear}">按班级设置</a>&nbsp;</td>
                </tr>
            </table></td>
          </tr>
          <tr>
            <td align="left" valign="top">
            <div id='myDiv' style=" position:relative;width:100%;height:500px;overflow:auto;" onscroll="floatTr(this)">
            <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#DCDCDC">
              <tr style='position:relative; top:0px;z-index:3' id="ftr">
                <td width="10%" height="30" align="center" bgcolor="#DBE9F6" class="f_4">人员</td>
                <c:set value="1" var="i" />
                <c:forEach items="${requestScope.courseList}" var="course">
                  <td align="center" bgcolor="#DBE9F6" class="f_4">${course.name }</td>
                  <c:set value="${i+1}" var="i" />
                </c:forEach>
              </tr>
              <c:choose>
                <c:when test="${! empty requestScope.UserList}">
                  <c:forEach items="${requestScope.UserList}" var="user">
	                <tr>
	                  <td height="30" bgcolor="#FFFFFF" class="f_4" nowrap="nowrap" align="center"> &nbsp;${user.name }</td>
	                  <c:forEach items="${requestScope.courseList}" var="course">
	                     <c:if test="${! empty requestScope.map}">
	                       <c:set value="${user.userId}${course.courseId }" var="UserCourse" />
	                    	<td align="center" bgcolor="#FFFFFF" width="${100/i }%" nowrap="nowrap" onclick="showModel2('${user.userId }','${course.courseId }',this);" onmouseover="this.style.backgroundColor='#e4f5ff'" onmouseout="this.style.backgroundColor=''" style="cursor:pointer;">
                     	 	 <c:if test="${! empty map[UserCourse]}">
                     	 		<c:forEach items="${map[UserCourse]}" var="cla">
                     	 		${cla.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>
                     	 	 	</c:forEach>
                     	 	 </c:if>
	                     	 <c:if test="${empty map[UserCourse]}">
	                     	 	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	                     	 </c:if>
	                    	</td>
	                     </c:if>
	                     <c:if test="${empty requestScope.map}">
	                     <td bgcolor="#FFFFFF" onclick="showModel2('${user.userId}','${course.courseId }',this);" onmouseover="this.style.backgroundColor='#e4f5ff'" onmouseout="this.style.backgroundColor=''" style="cursor:pointer;">
	                     &nbsp;
	                     </td>
	                     </c:if>
	                   </c:forEach>
	                </tr>
	              </c:forEach>
                </c:when>
                <c:otherwise><tr><td bgcolor="#FFFFFF" align="center" height="30" colspan="${i }"><font color="#CCCCCC">无人员信息</font></td></tr></c:otherwise>
              </c:choose>
            </table>
            </div>
             </td>
          </tr>
        </table>
          </td>
      </tr>
      <tr>
        <td><shiyue:paging/></td>
      </tr>
    </table></td>
  </tr>
</table>
  </body>
</html>
